﻿
<div id="main-wrapper">
	<h1>欢迎使用演讲家</h1>
	<form id="form-join">
		<div class="form-group">
			<input type="text" class="form-control" name="key" placeholder="讲座序列号">
		</div>
		<div class="form-group">
			<input type="text" class="form-control" name="nick" placeholder="听众昵称">
		</div>
		<div class="form-group">
			<button type="submit" class="btn btn-primary btn-lg btn-block">
				加入讲座
			</button>
		</div>
	</form>
</div>

<script>
	var key = getHashParams()['key'],
		$formJoin = $('#form-join');

	if (key) {
		$formJoin.find('[name="key"]').attr('readonly', true).val(key);
	}

	$formJoin.ajaxForm({
		url: '/do/a/join',
		success: function(res){
			if (res['ok']) $window.trigger('enter_lecture', '#/view');
		}
	});
</script>